<template>
  <div>
    <div class="title_box mt-30">
      <p class="title">行政处罚信息</p>
      <div class="line"></div>
    </div>

    <div class="mt-16">
      <a-table :columns="punishInfo" :data-source="punishData" :pagination="punishpagination"
        :rowKey="(record) => record.id">
        <a slot="name" slot-scope="text">{{ text }}</a>
      </a-table>
    </div>
  </div>
</template>

<script>
import {
  getEntPenaltyPageList,
} from "@/apis/EntBase";
export default {
  data () {
    return {
      punishpagination: {
        total: 0,
        pageSize: 10,
        current: 1,
        pageSizeOptions: ["10", "20", "30", "40", "50"],
        showTotal: (total) => `共有 ${total} 条数据`,
        showQuickJumper: true,
        showSizeChanger: true,
        onShowSizeChange: (current, pageSize) =>
          this.punishonSizeChange(current, pageSize),
        onChange: (page, pageSize) => this.punishonPageChange(page, pageSize),
      },
      punishData: [],
      punishInfo: [
        {
          dataIndex: "index",
          title: "序号",
          customRender: (text, record, index) => `${index + 1}`, // 显示每一行的序
        },
        {
          dataIndex: "punishNo",
          title: "决定书文号",
        },
        {
          dataIndex: "type",
          title: "违法行为类型",
        },
        {
          dataIndex: "content",
          title: "行政处罚内容",
        },
        {
          dataIndex: "departmentName",
          title: "决定机关名称",
        },
        {
          dataIndex: "punishDate",
          title: "处罚决定日期",
        },
        {
          dataIndex: "publicityDate",
          title: "公示日期",
        },
      ]
    }
  },
  methods: {

    // 获取行政处罚
    getEntPenaltyPageList () {
      let _params = {
        current: this.punishpagination.current,
        entId: this.entId,
        size: this.punishpagination.pageSize,
      };
      getEntPenaltyPageList(_params)
        .then((res) => {
          console.log("行政处罚信息");
          console.log(res);
          if (res.code == 200) {
            this.punishData = res.data.records;
            this.punishpagination.total = res.data.total;
          }
        })
        .catch((error) => { });
    },
    // 行政处罚  当前页码
    punishonPageChange (page, pageSize) {
      this.punishpagination.current = page;
      this.getEntPenaltyPageList();
    },
    // 行政处罚  每页条数
    punishonSizeChange (current, pageSize) {
      this.punishpagination.pageSize = pageSize;
      this.getEntPenaltyPageList();
    },



  }
}
</script>
<style lang="less" scoped>
.title_box {
  border-bottom: solid 1px #ebeef5;

  .title {
    font-size: 16px;
    line-height: 14px;
    letter-spacing: 0px;
    color: #303133;
  }

  .line {
    width: 20px;
    height: 4px;
    background-color: #188af1;
    margin-top: 8px;
  }
}
</style>